package com.quan.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.io.File;

/**
 * @author: xiexinquan520@163.com
 * User: XieXinQuan
 * DATE:2020/8/10
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        String userDirPath = System.getProperty("user.dir");
        userDirPath = "file:" + userDirPath + File.separator + "webimages" + File.separator;
        registry.addResourceHandler("/webimages/**").addResourceLocations(userDirPath);
        super.addResourceHandlers(registry);
    }
}
